home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
I-Z
/
MEdit_1.5.cpt
/
Macros .mcr
< prev
next >
Wrap
Text File
|
1986-11-07
|
6KB
|
318 lines
**************************************************************************
* This macro file is provided as a collection of useful example macros *
* You need MComp version 1.0D4 or later to compile this file. *
* Written : 05.01.86 Matthias Aebi *
* Last modification : 19.07.86 Matthias Aebi *
**************************************************************************
* 1
* This macro can be used to get irregulary spaced tabs.
* Write a dot in the first line of the window for every tab stop
* that you would like to use.
"Tabs" {
Push;
Select(0,C.);
Push;
Find(".");
Select(0,C[ | 0,C.);
Copy;
Drop;
Pop;
Paste;
Insert(" ");
};
* For use together with the following macros
* 2
"Save current Position/P" {
push;
};
* 3
* Jumps back to the last saved position with macro 2
* the stack can hold the last eight positions
"Back to Position/B" {
select(L[,C[)!;
pop;
};
* 4
* Moves the current selection to the position / selection
* previously saved with macro 2
"Move selection/M" {
cut;
pop;
paste!;
};
* 5
* Copies the current selection to the position / selection
* previously saved with macro 2
"Copy selection/K" {
copy;
pop;
paste!;
};
* 6
* Draw a line in the menu
"-" {};
* 7
* Jump to bottom of file (last line of last section)
"Bottom" {
Sect(S$);
Select(L$,C$)!;
};
* 8
* Jump to top of file
"Top" {
SECT(0);
SELECT(0,0)!;
};
* 9
* Select all lines in the current section
"Select all" {
SELECT(0,0|L$,C$);
};
* 10
* Move all lines in the current selection four positions to the left
* by deleting the leftmost characters. do nothing for empty lines.
"Move selection left/L" {
PUSH;
WHILE L. < L] {
SELECT(L.,0|L.,4);
CLEAR;
SELECT(L.+1,0)!;
};
SELECT(L[,0|L],0);
DROP;
};
* 11
* Move all lines in the current selection to the right by inserting
* a tab. do nothing for empty lines.
"Move selection right/R" {
PUSH;
WHILE L. < L] {
SELECT(L.,0);
IF NOT C$ = 0
INSERT("\t");
SELECT(L.+1,0)!;
};
SELECT(L[,0|L],0);
DROP;
};
* 12
* Ask for a line number to jump to and do it
"Jump to Line/J" {
prompt("Goto Line",#0);
select(#0-1,0|#0-1,C$)!;
};
* 13
* Ask for a section number to jump to and do it
"Jump to Section/S" {
prompt("Goto Section",#0);
sect(#0);
select(0,0)!;
};
* 14
* Replace the shortcut to the left of the cursor position with
* the appropriate string. To define shortcuts list them in a
* second window just behind the current text window. Each shortcut
* should be followed by the string by which it should be replaced.
* Use one line for each shortcut. separate string and shortcut by a blank.
* examples: (Define them without an asterik at the start of the window)
*
* ilm I like Macintosh
* gb Good bye
*
* If you type 'ilm' and then press command-g this will replace
* 'ilm' with 'I like Macintosh'. 'gb' will be replaced by 'Good bye'
"Glossary/G" {
Select(L.,C<|L.,C.);
Push;
Set($0,$S);
Window(1);
Select(0,0);
If Find($0) {
Select(L.,C:+1|L.,C$);
Copy;
Window(0);
Pop;
Paste;
}
Else {
Pop;
Select(L:,C:);
};
};
* 15
* Find next word and select it.
* If you have a Mac+ or a numeric keypad you may use shift-cursor-right
"Next Word" 266 {
select(L:,C:+1);
if C. = C$ AND NOT L. = L$
select(L.+1,0);
while C> = -1 AND NOT L. = L$
select(L.+1,0);
select(L.,C>);
select(L.,C< | L.,C.);
};
* 16
* Find previous word and select it.
* If you have a Mac+ or a numeric keypad you may use shift-cursor-left
"Previous Word" 270 {
select(L.,C.-1);
if C. = 0
select(L.-1,C$);
while C< = -1
select(L.-1,C$);
select(L.,C<);
select(L.,C. | L.,C>);
};
* 17
* Replace all 'real' tabs by blank strings
* this is useful to convert 'Edit'- to 'MEdit'-files
"Replace tabs" {
SELECT(0,0);
SECT(0);
WHILE FIND("\9")
INSERT("\t");
BEEP;
};
* 18
* Scroll one screen down.
* If you have a Mac+ or a numeric keypad you may use shift-cursor-down
"Page Down/D" 272 {
* get screen height
Set(#9, L>-L<-1);
Select(L>+#9,C.)!;
};
* 19
* Scroll one screen up.
* If you have a Mac+ or a numeric keypad you may use shift-cursor-up
"Page Up/U" 277 {
* get screen height
Set(#9, L>-L<-1);
Select(L<-#9,C.)!;
};
* 20
"Append Section" {
Append;
};
* 21
"-" {};
* 22
* The numbers define cursor keys on a Mac Plus / num Keypad
"Cursor Up/2" 177 {
SELECT(L.-1,C.)!;
};
* 23
"Cursor Down/A" 172 {
SELECT(L.+1,C.)!;
};
* 24
"Cursor Right/W" 166 {
* The following instruction sets the last accessed line to current line.
* This is necessary to get the correct result from C$ in 'IF C. = C$...'
SELECT(L.,C.);
IF C. = C$
SELECT(L.+1,0)!
ELSE
SELECT(L.,C.+1)!;
};
* 25
"Cursor Left/Q" 170 {
IF NOT C. > 0
SELECT(L.-1,C$)!
ELSE
SELECT(L.,C.-1)!;
};
* This macro could be used to
* redefinie shift-BS to 'delete to end of line' instead of 'delete right char'
* 251 {
* Select(L.,C.|L.,C$);
* Clear;
*};
* 26
* TAB:
* inserts blanks to next tab position
148 {
INSERT("\t");
};
* 27
* shift - TAB:
* deletes characters back to previous tab position
248 {
INSERT("\T");
};
* 28
* option - TAB:
* insert a 'real' tab
348 {
INSERT("\9");
};
* 29
* CR:
* insert newline and do autoindent if selected
* NOTE: the key number 236 is correct for a german mac+ keyboard only!
136 {
INSERT("\n");
};
* 30
* shift - CR:
* insert newline with autoindent flag toggled
* NOTE: the key number 236 is correct for a german mac+ keyboard only!
236 {
INSERT("\N");
};
* 31
* shift - BS:
* delete right character
251 {
INSERT("\B");
};
* 32
* option - BS
* swap the to characters just before the current position
351 {
SELECT(L.,C.-1|L.,C.);
CUT;
SELECT(L.,C.-1);
PASTE;
SELECT(L.,C.+1);
}.